package cn.com.ccxe.dao.parser;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.com.ccxe.core.entity.CrawlExpression;

public class CrawlExpressionParser implements ResultSetParser<CrawlExpression> {
	public List<CrawlExpression> parse(ResultSet rs) throws SQLException {
		List<CrawlExpression> listPageList = new ArrayList<CrawlExpression>();
		while (rs.next()) {
			listPageList.add(parseListPage(rs));
		}
		return listPageList;
	}

	public CrawlExpression parseObject(ResultSet rs) throws SQLException {
		return parseListPage(rs);
	}
	
	private CrawlExpression parseListPage(ResultSet rs) throws SQLException {
		CrawlExpression listPage = new CrawlExpression();
		listPage.setModuleId(rs.getInt("moduleId"));
		listPage.setListPageExpre(rs.getString("listPageExpre"));
		listPage.setArticleListExpre(rs.getString("articleListExpre"));
		listPage.setDatePattern(rs.getString("datePattern"));
		listPage.setDateExpre(rs.getString("dateExpre"));
		return listPage;
	}
}